<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>米尔豪斯酒店后台管理系统</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="../../css/consult.css">
    <link rel="stylesheet" type="text/css" href="../../css/page.css">
    <script type="text/javascript" language="javascript">
        function confirmAct() {
            if(confirm('确定要退出登陆吗?') == true) {
                window.location.href="../../html/admin_login.html";
            }
        }
        function consult_delete(id) {
            window.location.href = "classifyAction.php?act=del&cid="+id;
        }
        function consult_editor(consult_id) {
            window.location.href = "classlfy_edit.php?cid="+consult_id;
        }
    </script>
</head>
<body>
<div class="all">
    <div class="all1">
        <h1>米尔豪斯酒店后台管理系统</h1>
    </div>

    <?php include '../menu.php'?>

    <?php

    session_start();
    header("Content-type:text/html;charset=utf-8");
    include "../../../lib/DB.php";
    include "../../../lib/Pagination.php";
    $db = new DB();
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $pageSize = isset($_GET['pageSize']) ? abs($_GET['pageSize']) : 10;
    $cat = $db->table('classification')->page($page,$pageSize)->order('cid desc')->select();
    $count = "select count(*) as count from  classification";
    $goodsCount = $db->table('classification')->query($count)['0']['count'];
    $pagination = new Pagination($goodsCount,$pageSize);

    ?>
    <div class="all3" >
        <div class="guide">
            <p><img src="../../img/主页.png">&nbsp;&nbsp;当前位置 ： 后台管理 > 菜品分类管理 </p>
        </div>
        <div class="data">
            <div class="add">
                <a href="../classify/classlfy_add.php"><img src="../../img/添加.png">&nbsp;添加</a>
            </div>
            <div class="content">
                <table class="table table-hover table-responsive">
                    <thead>
                    <tr>
                        <th width="">ID</th>
                        <th width="">分类名称</th>
                        <th width="">操作</th>
                    </tr>
                    </thead>


                    <?php foreach ($cat as $row):?>
                        <tr>
                            <td><?php echo $row['cid'] ?></td>
                            <td><?php echo $row['cname'] ?></td>
                            <td><button class="btn btn-info btn-xs" onclick="javascript:consult_editor(<?php echo $row['cid']?>)">编辑</button>&nbsp;&nbsp;
                                <button class="btn btn-danger btn-xs" onclick="javascript:consult_delete(<?php echo $row['cid']?>)">删除</button></td>
                        </tr>
                    <?php endforeach;?>

                </table>

                <div class="">
                    <?php echo $pagination->links()?>
                </div>

            </div>
        </div>
    </div>
    <div class="all4">
        <h3>米尔豪斯酒店</h3>
    </div>
</div>
</body>
</html>